<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>opennars: nars.language.CompoundTerm.applySubstitute</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">opennars
   &#160;<span id="projectnumber">1.5.5</span>
   </div>
   <div id="projectbrief">1.5-ish</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../namespaces.html"><span>Packages</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d0/dee/classnars_1_1language_1_1CompoundTerm_a7899e3d2c69785eeb83f2b78bf474da6.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="contents">
<a class="anchor" id="a7899e3d2c69785eeb83f2b78bf474da6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void nars.language.CompoundTerm.applySubstitute </td>
          <td>(</td>
          <td class="paramtype">HashMap&lt; <a class="el" href="../../d8/db8/classnars_1_1language_1_1Term.html">Term</a>, <a class="el" href="../../d8/db8/classnars_1_1language_1_1Term.html">Term</a> &gt;&#160;</td>
          <td class="paramname"><em>subs</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Recursively apply a substitute to the current <a class="el" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html" title="A CompoundTerm is a Term with internal (syntactic) structure. ">CompoundTerm</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">subs</td><td></td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00547">547</a> of file <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html">CompoundTerm.java</a>.</p>

<p>References <a class="el" href="../../d8/df2/Term_8java_source.html#l00083">nars.language.Term.clone()</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00356">nars.language.CompoundTerm.componentAt()</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00039">nars.language.CompoundTerm.components</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00078">nars.language.CompoundTerm.CompoundTerm()</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00338">nars.language.CompoundTerm.isCommutative()</a>, <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00234">nars.language.CompoundTerm.makeName()</a>, <a class="el" href="../../d8/df2/Term_8java_source.html#l00046">nars.language.Term.name</a>, and <a class="el" href="../../d5/d0e/CompoundTerm_8java_source.html#l00347">nars.language.CompoundTerm.size()</a>.</p>

<p>Referenced by <a class="el" href="../../d4/d15/CompositionalRules_8java_source.html#l00483">nars.inference.CompositionalRules.introVarInner()</a>.</p>
<div class="fragment"><div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;                                                          {</div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;        <a class="code" href="../../d8/db8/classnars_1_1language_1_1Term.html">Term</a> t1, t2;</div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ac81c5851f664320ddec435641f198b03.html#ac81c5851f664320ddec435641f198b03">size</a>(); i++) {</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;            t1 = <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_acedae916705e9fa1669391a7d728b840.html#acedae916705e9fa1669391a7d728b840">componentAt</a>(i);</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;<span class="comment">//            if (t1 instanceof Variable) {</span></div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;            t2 = subs.get(t1);</div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;            <span class="keywordflow">if</span> (t2 != null) {</div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;                <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">components</a>.set(i, (<a class="code" href="../../d8/db8/classnars_1_1language_1_1Term.html">Term</a>) t2.<a class="code" href="../../d8/db8/classnars_1_1language_1_1Term_ae2dba162b71bb9b806f54832249a260c.html#ae2dba162b71bb9b806f54832249a260c">clone</a>());</div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;<span class="comment">//                }</span></div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;            } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (t1 instanceof <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html">CompoundTerm</a>) {</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;                ((<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0.html#a89000afae8017231889aaa549292d1e0">CompoundTerm</a>) t1).applySubstitute(subs);</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;            }</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;        }</div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;        <span class="keywordflow">if</span> (this.<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a43c073fe9f5a36241c475a2bc8736800.html#a43c073fe9f5a36241c475a2bc8736800">isCommutative</a>()) {         <span class="comment">// re-order</span></div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;            TreeSet&lt;Term&gt; s = <span class="keyword">new</span> TreeSet&lt;Term&gt;(<a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">components</a>);</div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;            <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">components</a> = <span class="keyword">new</span> ArrayList&lt;Term&gt;(s);</div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;        }</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;        <a class="code" href="../../d8/db8/classnars_1_1language_1_1Term_a059f44677d4580c0eef198dfba957b6b.html#a059f44677d4580c0eef198dfba957b6b">name</a> = <a class="code" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_aa26a304f6249c185836d8fde8b8f17a8.html#aa26a304f6249c185836d8fde8b8f17a8">makeName</a>();</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    }</div>
<div class="ttc" id="classnars_1_1language_1_1Term_ae2dba162b71bb9b806f54832249a260c_html_ae2dba162b71bb9b806f54832249a260c"><div class="ttname"><a href="../../d8/db8/classnars_1_1language_1_1Term_ae2dba162b71bb9b806f54832249a260c.html#ae2dba162b71bb9b806f54832249a260c">nars.language.Term.clone</a></div><div class="ttdeci">Object clone()</div><div class="ttdoc">Make a new Term with the same name. </div><div class="ttdef"><b>Definition:</b> <a href="../../d8/df2/Term_8java_source.html#l00083">Term.java:83</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_aa26a304f6249c185836d8fde8b8f17a8_html_aa26a304f6249c185836d8fde8b8f17a8"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_aa26a304f6249c185836d8fde8b8f17a8.html#aa26a304f6249c185836d8fde8b8f17a8">nars.language.CompoundTerm.makeName</a></div><div class="ttdeci">String makeName()</div><div class="ttdoc">default method to make the oldName of the current term from existing fields </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00234">CompoundTerm.java:234</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1Term_a059f44677d4580c0eef198dfba957b6b_html_a059f44677d4580c0eef198dfba957b6b"><div class="ttname"><a href="../../d8/db8/classnars_1_1language_1_1Term_a059f44677d4580c0eef198dfba957b6b.html#a059f44677d4580c0eef198dfba957b6b">nars.language.Term.name</a></div><div class="ttdeci">String name</div><div class="ttdoc">A Term is identified uniquely by its name, a sequence of characters in a given alphabet (ASCII or Uni...</div><div class="ttdef"><b>Definition:</b> <a href="../../d8/df2/Term_8java_source.html#l00046">Term.java:46</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0_html_a89000afae8017231889aaa549292d1e0"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a89000afae8017231889aaa549292d1e0.html#a89000afae8017231889aaa549292d1e0">nars.language.CompoundTerm.CompoundTerm</a></div><div class="ttdeci">CompoundTerm()</div><div class="ttdoc">Default constructor. </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00078">CompoundTerm.java:78</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_ac81c5851f664320ddec435641f198b03_html_ac81c5851f664320ddec435641f198b03"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ac81c5851f664320ddec435641f198b03.html#ac81c5851f664320ddec435641f198b03">nars.language.CompoundTerm.size</a></div><div class="ttdeci">int size()</div><div class="ttdoc">get the number of components </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00347">CompoundTerm.java:347</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1Term_html"><div class="ttname"><a href="../../d8/db8/classnars_1_1language_1_1Term.html">nars.language.Term</a></div><div class="ttdoc">Term is the basic component of Narsese, and the object of processing in NARS. </div><div class="ttdef"><b>Definition:</b> <a href="../../d8/df2/Term_8java_source.html#l00040">Term.java:40</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb_html_ad340d3bb55dcfcdf237fe4ee225d3cbb"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_ad340d3bb55dcfcdf237fe4ee225d3cbb.html#ad340d3bb55dcfcdf237fe4ee225d3cbb">nars.language.CompoundTerm.components</a></div><div class="ttdeci">ArrayList&lt; Term &gt; components</div><div class="ttdoc">list of (direct) components </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00039">CompoundTerm.java:39</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_acedae916705e9fa1669391a7d728b840_html_acedae916705e9fa1669391a7d728b840"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_acedae916705e9fa1669391a7d728b840.html#acedae916705e9fa1669391a7d728b840">nars.language.CompoundTerm.componentAt</a></div><div class="ttdeci">Term componentAt(int i)</div><div class="ttdoc">get a component by index </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00356">CompoundTerm.java:356</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_html"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html">nars.language.CompoundTerm</a></div><div class="ttdoc">A CompoundTerm is a Term with internal (syntactic) structure. </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00036">CompoundTerm.java:36</a></div></div>
<div class="ttc" id="classnars_1_1language_1_1CompoundTerm_a43c073fe9f5a36241c475a2bc8736800_html_a43c073fe9f5a36241c475a2bc8736800"><div class="ttname"><a href="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a43c073fe9f5a36241c475a2bc8736800.html#a43c073fe9f5a36241c475a2bc8736800">nars.language.CompoundTerm.isCommutative</a></div><div class="ttdeci">boolean isCommutative()</div><div class="ttdoc">Check if the order of the components matters. </div><div class="ttdef"><b>Definition:</b> <a href="../../d5/d0e/CompoundTerm_8java_source.html#l00338">CompoundTerm.java:338</a></div></div>
</div><!-- fragment -->
<p><div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="../../closed.png" alt="+"/> Here is the call graph for this function:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a7899e3d2c69785eeb83f2b78bf474da6_a7899e3d2c69785eeb83f2b78bf474da6_cgraph.svg" width="100%" height="530"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</p>

<p><div id="dynsection-1" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-1-trigger" src="../../closed.png" alt="+"/> Here is the caller graph for this function:</div>
<div id="dynsection-1-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-1-content" class="dyncontent" style="display:none;">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d0/dee/classnars_1_1language_1_1CompoundTerm_a7899e3d2c69785eeb83f2b78bf474da6_a7899e3d2c69785eeb83f2b78bf474da6_icgraph.svg" width="100%" height="383"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../d7/d81/namespacenars.html">nars</a></li><li class="navelem"><a class="el" href="../../d0/d72/namespacenars_1_1language.html">language</a></li><li class="navelem"><a class="el" href="../../d0/dee/classnars_1_1language_1_1CompoundTerm.html">CompoundTerm</a></li>
    <li class="footer">Generated on Sun Jan 10 2016 18:03:59 for opennars by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
